<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<ul>
  <li>li1</li>
  <li>li2</li>
  <li>li3</li>
  <li>li4</li>
  <li>li5</li>
</ul>
<script>
  var ul = document.querySelector('ul');

  // var children = ul.childNodes;
  // var children = ul.children;
  // console.log(children); // => HTMLCollection(5) [li, li, li, li, li]
  console.log(ul.firstChild);  // => #text
  console.log(ul.lastChild);  // => #text
  console.log(ul.firstElementChild); // => <li>li1</li>
  console.log(ul.lastElementChild);  // => <li>li5</li>
</script>
</body>
</html>